using System;
using System.Collections.Generic;
using System.Text;

namespace ClientTools.Library.Media
{
    public class Media
    {

        public Media() { }
        public Media(umbraco.cms.businesslogic.media.Media umbracoMedia) 
        {
            this.Id = umbracoMedia.Id;
            this.Name = umbracoMedia.Text;
            this.NodeTypeId = umbracoMedia.ContentType.Id;
            this.NodeTypeAlias = umbracoMedia.ContentType.Text;

            foreach (umbraco.cms.businesslogic.property.Property umbracoProperty in umbracoMedia.getProperties)
            {
                this.Properties.Add(new Property(umbracoProperty));
            }
        }

        private int _id;
        private string _name;
        private string _nodeTypeAlias;
        private int _nodeTypeId;
        private MediaCollection _children = new MediaCollection();
        private PropertyCollection _properties = new PropertyCollection();

        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public string NodeTypeAlias
        {
            get { return _nodeTypeAlias; }
            set { _nodeTypeAlias = value; }
        }

        public int NodeTypeId
        {
            get { return _nodeTypeId; }
            set { _nodeTypeId = value; }
        }

        public MediaCollection Children
        {
            get { return _children; }
            set { _children = value; }
        }

        public PropertyCollection Properties
        {
            get { return _properties; }
            set { _properties = value; }
        }
    }
}
